import 'package:flutter/material.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';

//订单信息
class RepairOrderInfo extends StatefulWidget {
  final String orderState;

  const RepairOrderInfo({Key key, this.orderState}) : super(key: key);
  @override
  _RepairOrderInfoState createState() => _RepairOrderInfoState();
}

class _RepairOrderInfoState extends State<RepairOrderInfo> {
  List<String> orderInfo = [
    "订单编号",
    "订单时间",
    "推修来源",
    "车辆型号",
    "车辆牌号",
    "订单状态"
  ]; //訂單信息
  List<String> orderContent = [
    "AE9998820031",
    "2017-09-21 17：00",
    "太平洋保险",
    "路虎极光 雅致版HS260",
    "苏A 98K98",
    "新推修订单"
  ]; //訂單信息 内容
  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        physics: NeverScrollableScrollPhysics(),
        shrinkWrap: true,
        itemCount: orderInfo.length,
        itemBuilder: (context, index) {
          return _orderInfo(title: orderInfo[index],
              content: orderContent[index]);
        });
  }
  //订单信息
  Widget _orderInfo({String title, String content}) {
    return Container(
      padding: EdgeInsets.only(top: setWidth(20)),
      height: setWidth(37),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Expanded(
            child: RichText(
                text: TextSpan(children: [
                  TextSpan(
                      text: "$title:",
                      style:
                      TextStyle(color: Color(0xff999999), fontSize: setSp(15))),
                  WidgetSpan(
                      child: SizedBox(
                        width: setWidth(3),
                      )),
                  TextSpan(
                      text:title == "订单状态"?widget?.orderState??"": content,
                      style:
                      TextStyle(color: title == "订单状态"?Color(0xffFF4D4D):Color(0xff323232), fontSize: setSp(15))),
                ])),
          ),
        ],
      ),
    );
  }
}
